package no.sachmuld.methodcombination.examples.reflection.roles.employee;


import no.sachmuld.methodcombination.examples.reflection.roles.employee.api.Consultant;
import no.sachmuld.methodcombination.examples.reflection.roles.employee.api.Employee;
import no.sachmuld.methodcombination.examples.reflection.roles.employee.api.EmployeeService;
import no.sachmuld.methodcombination.examples.reflection.roles.employee.api.Manager;
import no.sachmuld.methodcombination.examples.reflection.roles.employee.lib.EmployeeServiceImpl;

/**
 *
 */
public class Main implements Runnable {

    @Override
    public void run() {

        EmployeeService service = new EmployeeServiceImpl();

        Employee bill = service.createEmployee(100000);
        Employee emma = service.createEmployeeWithRole(100000, Manager.class);
        Employee mary = service.createEmployeeWithRole(100000, Manager.class, Consultant.class);

        emma.as(Manager.class).addEmployee(bill);
        mary.as(Manager.class).addEmployee(emma);
        mary.as(Consultant.class).setInvoicingPercentage(0.9);

        Employee[] employees = { bill, emma, mary };

        for (Employee employee : employees) {
            System.out.println(employee.salary());
        }

    }

    public static void main(String... args) {

        new Main().run();

    }
}
